<?php
    require('config/config.php');
    include('header.php');
?>
    <!-- Header -->
    <header class="container_12 " id="header">
        <div class="grid_3 alpha">
            <img src="./stylesheets/images/logo1.png" alt="Logo"/>
        </div>
<?php
    require 'tableauCriticite.php';
?>
    </header>
    <!-- End Header -->
    <!-- Content -->
    <div class="clear"></div>
    <section class=" content">
<?php
    require 'menu.php';
?>
        
    <?php
        //création de la variable 
        $id_machine = $_GET['machineID'];

        $machine = Machine::recherche(array("id" => $id_machine), true);

        $tabInfoMachine = Evenement::getInformationByMachine($machine);
    ?>

    <!-- detail terminal -->
        <div>
            <table class="tabInfos">
                <caption>Informations sur la machine</caption>
                <thead>
                    <tr>
                      <th>Nom</th>
                      <th>Adresse IP</th>
                      <th>Position physique</th>
                      <th>Community du SNMP</th>
                      <th>Date d'affectation</th>
                      <th>Type</th>
                      <th>Département</th>
                    </tr>
                </thead>
                <tbody>
                    <tr style="border-bottom:1px solid black">
                      <td><?php /*affichage du nom de la machine*/ echo $machine->getNomMachine(); ?></td>
                      <td><?php /*affichage de l'ip de la machine*/ echo $machine->getAdresseIp(); ?></td>
                      <td><?php /*affichage de la position de la machine*/ echo $machine->getPositionPhysique(); ?></td>
                      <td><?php /*affichage du community du snmp de la machine*/ echo $machine->getCommunity(); ?></td>
                      <td><?php /*affichage de la date d'affectation de la machine*/ echo $machine->getDateAffectation(); ?></td>
                      <td><?php /*affichage du type de la machine*/ echo $machine->getTypeMachine()->getNomType(); ?></td>
                      <td><?php /*affichage du service de la machine*/ echo $machine->getService()->getNomService(); ?></td>
                    </tr>
                    <tr style="border-bottom:1px solid black;background-color: #343640;color:#FFFFFF;">
                      <td></td>
                      <td>Service monitoré</td>
                      <td>Statut</td>
                      <td>Dernier check</td>
                      <td>Informations</td>
                      <td></td>
                      <td></td>
                    </tr>
                        <?php 
                        foreach($tabInfoMachine as $info) {
                                echo '<tr>';
                                    echo '<td></td>';
                                    echo '<td>'.$info['service'].'</td>';
                                    echo '<td>'.$info['status'].'</td>';
                                    echo '<td>'.$info['checkD'].'</td>';
                                    echo '<td><p>' .$info['infos']. '</p></td>';
                                    echo '<td></td>';
                                    echo '<td></td>';
                                echo '</tr>';
                            }
                        ?>
                </tbody>
            </table>
           
        
            </div>
    </section>
    <!-- End detail terminal -->
    <!-- Footer -->
<?php
    include 'footer.php';
 ?>
    <!-- End Footer -->
</body>
</html>